﻿using System;
using System.Globalization;
#if NETFX_CORE
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Media;
using Windows.UI;
using Windows.UI.Xaml;
#else
using System.Windows.Data;
using System.Windows.Media;
#endif

namespace UnitDriven.Controls
{
	public class TestStatusConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            return Convert(value, targetType, parameter, new CultureInfo(language));
        }

		public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			TestResult status = (TestResult)value;
			switch (status)
			{
				case TestResult.Indeterminate:
					return new SolidColorBrush(Colors.Yellow);
				case TestResult.Success:
					return new SolidColorBrush(Colors.Green);
				case TestResult.Fail:
					return new SolidColorBrush(Colors.Red);
				case TestResult.Evaluating:
					return new SolidColorBrush(Colors.DarkGray);
				default:
					return new SolidColorBrush(Colors.LightGray);
			}
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			throw new NotImplementedException();
		}

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            throw new NotImplementedException();
        }
    }
}
